package ar.com.fiuba.ElectronicCircuitAnalyst.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class MapFunction<FromType, ToType>{
	public static <FromType, ToType> List<ToType> map(List<FromType> list, MapDelegate<FromType, ToType> mapDelegate) {
		List<ToType> ret = new ArrayList<ToType>(list.size());
		Iterator<FromType> it = list.iterator();
		while (it.hasNext()) {
			ret.add(mapDelegate.map(it.next()));
		}
		return ret;
	}
}
